<?php
class EntityBase
{
	public function __construct()
	{
	}

	/**
	 * Format date
	 *
	 * @access public
	 *
	 * @return string date has been formatted
	 *
	 */
	public function formatDate($date, $format = "d F Y")
	{
		// Validate parameter
		if(is_null($date) || empty($date)){
			return null;
		}

		return CommonUtils::formatDate($date, $format);
	}

	/**
	 * Format currency
	 *
	 * @access public
	 *
	 * @return string currency has been formatted
	 *
	 */
	public function formatCurrency($value, $format = "\$")
	{
		$value = !is_null($value) ? $value : 0;

		return CommonUtils::formatCurrency($value, $format);
	}
	
	/**
	 * Un Quote
	 * 
	 * @param string $value
	 * 
	 * @return string has been unquote
	 */
	public function unQuote($value)
	{
		if(is_null($value) || empty($value)){
			return $value;
		}
		$value = str_replace("\\'", "'", $value);
		return  str_replace("\\\"", "\"", $value);
	}
	
	/**
	 * Get Default Photo in case Picture not found 
	 */
	public function getDefaultImage()
	{
		return Zend_Registry::get('config')->APPLICATION_URL . "/no_picture.jpg";
	}
}